import request from "@/utils/request";
import type { CourseReview, CourseReviewAuditHistory, CourseReviewPageQuery } from "./type";

/*
 * @Author: anxia.ack anchenkai@come-future.com
 * @Date: 2025-04-19 23:50:59
 * @LastEditors: anxia.ack anchenkai@come-future.com
 * @LastEditTime: 2025-04-20 01:27:03
 * @FilePath: /free-learning/src/api/course/course-review/index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const BASE_URL = "/api/v1/course/review";
export const quertReviewPage = (
  courseReviewPageQuery: Partial<CourseReviewPageQuery>
): Promise<MyPageResult<CourseReview[]>> => {
  return request.post(BASE_URL + "/page", courseReviewPageQuery);
};

export const auditReview = (courseReview: Partial<CourseReview>) => {
  return request.put(BASE_URL + "/audit", courseReview);
};

export const deleteCourseReview = (id: number): Promise<boolean> => {
  return request.delete(`${BASE_URL}/delete/${id}`);
};

export const getAuditHistory = (id: number): Promise<CourseReviewAuditHistory[]> => {
  return request.get(`${BASE_URL}/audit/history/${id}`);
};
